BMEN90033 · Week 7
Back
BMEN90033 · WEEK 7 · BIOINSTRUMENTATION

The Inverted Pendulum.

An open-loop unstable plant. The transfer function is derived, the right-half-plane pole responsible for instability is identified, and a feedback controller is constructed that relocates the closed-loop poles into the stable region.

stability feedback pole placement
scroll
01the system

A pendulum supported above its pivot.

The inverted pendulum consists of a uniform rigid rod of length $L$ and point mass $m$ mounted at its base on a frictionless pivot, with the mass positioned above the pivot rather than below. The angle $\theta$ is measured from the upright vertical.

An external torque $\tau(t)$, supplied by a motor at the pivot, constitutes the input. The angle $\theta(t)$ is the output. A viscous damping coefficient $b$ acts on the angular velocity. The configuration differs from the conventional gravity pendulum only in the orientation of the mass, but this change reverses the sign of the gravitational term, with consequences developed below.

The objective is to express this difference as a property of the transfer function, and to introduce a controller that restores stability without modifying the plant.

geometry · upright equilibrium
02equation of motion

Torque balance about the pivot.

Newton's second law for rotation about the pivot is $I\ddot{\theta} = \sum \tau$, with $I = mL^2$ the moment of inertia of a point mass at radius $L$. Three torques act about the pivot.

showfull derivation · 4 steps

Step 1 · enumerate the torques

Three contributions act about the pivot:

  • Gravity acts vertically downward on the mass at height $L\cos\theta$ above the pivot. The horizontal moment arm is $L\sin\theta$. Because the mass lies above the pivot, gravity acts to increase $\theta$ rather than restore it: $\tau_g = +mgL\sin\theta$.
  • Viscous damping at the pivot: $\tau_d = -b\,\dot{\theta}$.
  • Applied torque from the motor: $\tau_a = \tau(t)$.
$$mL^2\,\ddot{\theta} = mgL\sin\theta - b\,\dot{\theta} + \tau(t).$$

Step 2 · linearise about the upright equilibrium

For small $\theta$ the Taylor expansion $\sin\theta = \theta - \theta^3/6 + \ldots$ is truncated at first order, accurate to within $2\%$ for $\theta \le 20^\circ$:

$$mL^2\,\ddot{\theta} - mgL\,\theta + b\,\dot{\theta} = \tau(t).$$

The sign of the gravitational term is the single point of difference between this equation and that of the standard gravity pendulum. The standard pendulum carries $+mgL\theta$ on the left-hand side (a restoring stiffness); the inverted pendulum carries $-mgL\theta$ (a destabilising stiffness).

Step 3 · normalise

Dividing through by $mL^2$ and writing $\omega_0^2 = g/L$ for the natural angular frequency of the equivalent gravity pendulum:

$$\ddot{\theta} + \frac{b}{mL^2}\,\dot{\theta} - \omega_0^2\,\theta = \frac{\tau(t)}{mL^2}.$$

Step 4 · Laplace transform

Under quiescent initial conditions $\theta(0) = \dot{\theta}(0) = 0$, each derivative maps to a multiplication by $s$:

$$s^2\,\Theta(s) + \frac{b}{mL^2}\,s\,\Theta(s) - \omega_0^2\,\Theta(s) = \frac{T(s)}{mL^2}.$$

Factoring $\Theta(s)$ and forming the ratio $\Theta(s)/T(s)$ yields the open-loop transfer function, stated in the next section.

free-body diagram
03open-loop transfer function

The plant has a pole in the right half-plane.

From the linearised Laplace-domain equation, the open-loop transfer function $G(s)$ from applied torque to angle is

$$G(s) = \frac{\Theta(s)}{T(s)} = \frac{1/(mL^2)}{s^2 + \dfrac{b}{mL^2}\,s - \omega_0^2}.$$

The poles of $G(s)$ are the roots of its denominator. Setting the denominator to zero:

$$s^2 + \frac{b}{mL^2}\,s - \omega_0^2 = 0 \;\;\Longrightarrow\;\; s = -\frac{b}{2mL^2} \pm \sqrt{\left(\frac{b}{2mL^2}\right)^2 + \omega_0^2}.$$

The discriminant is strictly positive whenever $\omega_0 \ne 0$, so both poles are real. The second term under the square root exceeds the first in magnitude, so one pole lies on the positive real axis:

$$s_1 = -\frac{b}{2mL^2} + \sqrt{\left(\frac{b}{2mL^2}\right)^2 + \omega_0^2} \;>\; 0, \qquad s_2 \;<\; 0.$$

A pole in the right half-plane corresponds to a time-domain mode of the form $e^{s_1 t}$, which grows without bound. Any nonzero initial condition, including disturbance from sensor noise or air currents, projects onto this mode and produces unbounded growth. The system is therefore unstable in the bounded-input bounded-output sense.

Numerical instance

For $L = 0.5~\mathrm{m}$, $m = 1~\mathrm{kg}$, $b = 0.05~\mathrm{N{\cdot}m{\cdot}s/rad}$, and $g = 9.81~\mathrm{m/s^2}$ one finds $\omega_0 = \sqrt{g/L} \approx 4.43~\mathrm{rad/s}$. The poles are approximately $s_1 \approx +4.41$ and $s_2 \approx -4.51$. The unstable mode grows by a factor of $e \approx 2.72$ every $1/s_1 \approx 0.23~\mathrm{s}$.

Stability criterion. A linear system is stable if and only if every pole of its transfer function lies in the open left half of the complex plane. The presence of even a single pole with positive real part is sufficient to guarantee instability.
open-loop poles · s-plane
× poles stable region unstable region
04open-loop response

Open-loop response from a small perturbation.

The right-half-plane pole has a direct physical interpretation. With no applied torque, an initial perturbation $\theta(0) = \theta_0$ from the upright equilibrium evolves according to the homogeneous solution

$$\theta(t) = A\,e^{s_1 t} + B\,e^{s_2 t},$$

with constants $A$, $B$ fixed by the initial conditions. The decaying mode $e^{s_2 t}$ contributes a transient. The growing mode $e^{s_1 t}$ dominates within a fraction of a second, and the linearisation ceases to apply once $\theta$ leaves the small-angle regime. In the figure the linearised model is integrated until the angle reaches $\pm 90^\circ$, at which point the trajectory is held to indicate departure.

The time to depart from upright is approximately $(1/s_1)\,\ln(\theta_{\max}/\theta_0)$, growing only logarithmically as the perturbation is reduced. Halving $\theta_0$ delays departure by approximately $0.16~\mathrm{s}$; reducing it a thousand-fold delays it by only $1.6~\mathrm{s}$. No finite initial precision stabilises the system in open loop.

2.0°
0.50 m
0.050
unstable pole
stable pole
time to fall
Note. No combination of the physical parameters $L$, $m$, or $b$ moves the unstable pole into the left half-plane. Stability cannot be obtained by tuning the plant; it requires an external feedback path that supplies a corrective torque in response to the measured angle.
open-loop simulation
θ(t) divergent
05introducing a controller

Closing the loop with measurement and actuation.

A controller is a system that observes the output of the plant and computes an input intended to drive that output toward a desired reference. The arrangement of plant, sensor, controller, and summing junction constitutes a closed loop, as distinct from the open loop of the preceding sections.

The block diagram below states this structure. The reference $R(s)$ is the desired angle, set to zero for the upright stabilisation problem. The error $E(s) = R(s) - \Theta(s)$ is the difference between the reference and the measurement. The controller $C(s)$ acts on the error to produce a torque command $T(s) = C(s)\,E(s)$, which drives the plant $G(s)$.

Why feedback differs from open-loop tuning

The poles of the plant are properties of the physical assembly. They cannot be moved by any choice of input signal, since the input enters only the right-hand side of the differential equation. Feedback modifies the equation itself. Substituting $\tau = -K_p\theta - K_d\dot{\theta}$ converts the original

$$mL^2\ddot{\theta} + b\dot{\theta} - mgL\theta = \tau$$

into

$$mL^2\ddot{\theta} + (b + K_d)\dot{\theta} + (K_p - mgL)\theta = 0,$$

whose effective stiffness and damping are set by the controller gains. The next section derives the closed-loop transfer function from this substitution.

+
$R(s)$
$\Theta(s)$
$E(s)$
$T(s)$
controller
$C(s)$
plant
$G(s)$
measured $\Theta(s)$ returned to the summing junction
Reading the diagram. The forward path is $R \rightarrow E \rightarrow T \rightarrow \Theta$. The feedback path returns the measured output to the summing junction with a negative sign, so the controller acts on the error rather than the reference. This sign convention defines negative feedback.
06closed-loop transfer function

Closed-loop transfer function from block-diagram algebra.

The closed-loop transfer function $T_{cl}(s) = \Theta(s)/R(s)$ is obtained by writing the algebraic relations imposed by each block and eliminating the intermediate signals.

Block relations

Reading the block diagram from left to right:

Elimination

Substituting the controller relation into the plant relation:

$$\Theta(s) = G(s)\,C(s)\,E(s) = G(s)\,C(s)\,\bigl[R(s) - \Theta(s)\bigr].$$

Collecting the $\Theta(s)$ terms on the left:

$$\Theta(s)\bigl[1 + G(s)\,C(s)\bigr] = G(s)\,C(s)\,R(s).$$

Dividing yields the closed-loop transfer function:

$$T_{cl}(s) = \frac{\Theta(s)}{R(s)} = \frac{G(s)\,C(s)}{1 + G(s)\,C(s)}.$$

This is the standard result of feedback theory. Its denominator $1 + G(s)C(s)$ is the characteristic polynomial; the roots of this polynomial are the closed-loop poles, which determine the stability of the controlled system.

Pole relocation

The closed-loop poles are not the open-loop poles. They are the roots of $1 + G(s)C(s) = 0$, a polynomial whose coefficients depend on both the plant and the controller. With a suitable choice of $C(s)$, the closed-loop poles can be relocated to any positions consistent with the order of the polynomial. In particular, poles initially in the right half-plane can be moved into the left half-plane.

Application to the inverted pendulum

A proportional-derivative (PD) controller is taken, of the form $C(s) = K_p + K_d s$. This controller acts on both the angle $\theta$ and its rate of change $\dot{\theta}$. Multiplying $G(s)$ by $C(s)$:

$$G(s)C(s) = \frac{(K_p + K_d s)/(mL^2)}{s^2 + \dfrac{b}{mL^2}s - \omega_0^2}.$$

Substituting into $T_{cl}(s) = GC/(1 + GC)$ and clearing denominators:

$$T_{cl}(s) = \frac{K_p + K_d s}{mL^2 s^2 + (b + K_d)\,s + (K_p - mgL)}.$$

The denominator coefficients are functions of both plant parameters and controller gains. The conditions for both closed-loop poles to lie in the left half-plane follow from the Routh–Hurwitz criterion for a quadratic, which requires that all coefficients share the same sign:

$$\boxed{\;K_p > mgL \quad\text{and}\quad K_d > -b.\;}$$

The first condition requires the proportional gain to exceed the destabilising gravitational stiffness. The second is satisfied by any non-negative $K_d$. When both inequalities hold, the inverted pendulum is stabilised.

+
step 1 · block diagram with feedback
$R(s)$
$\Theta(s)$
$E(s)$
$T(s)$
controller
$C(s) = K_p + K_d\, s$
plant
$G(s) = \dfrac{1}{mL^2 s^2 + b\,s - mgL}$
step 2 · loop equation from the diagram
$\Theta(s) = G(s)\,C(s)\,\bigl[R(s) - \Theta(s)\bigr]$
step 3 · solve for the closed-loop transfer function
$\dfrac{\Theta(s)}{R(s)} = \dfrac{G(s)\,C(s)}{1 + G(s)\,C(s)}$
07placing the closed-loop poles

Closed-loop pole locations as a function of the gains.

The closed-loop denominator $mL^2 s^2 + (b + K_d) s + (K_p - mgL)$ is a quadratic whose roots admit a closed-form expression. Their position in the complex plane is fully determined by the two controller gains $K_p$ and $K_d$. The plot shows the closed-loop poles for the present gain selection alongside the open-loop poles for reference.

Three regimes are observed as $K_p$ is varied from below to above the critical value $mgL$:

8.00
0.60
0.50 m
$K_p^{\min} = mgL$
closed-loop poles
status
Geometric interpretation. Increasing $K_p$ above $mgL$ brings the two real closed-loop poles toward each other along the real axis; beyond a further critical value they leave the real axis as a complex-conjugate pair and move into the left half-plane. Increasing $K_d$ raises the damping of this pair without changing its natural frequency.
closed-loop poles vs gains
× open-loop poles · fixed ⊗ closed-loop poles · move with gains stable region
08closed-loop response

Closed-loop simulation under PD control.

With the PD controller active, the pendulum is integrated subject to the same initial perturbation as in Section 04, with the actuator driven by $\tau(t) = -K_p\,\theta(t) - K_d\,\dot{\theta}(t)$. The two pendulums shown share identical physical parameters and identical initial conditions; they differ only in whether the feedback loop is engaged.

The trace at the bottom of each panel shows the time evolution of $\theta$. The open-loop response diverges along $e^{s_1 t}$ as before. The closed-loop response, governed by the stable characteristic polynomial, decays toward zero with a time constant set by the real part of the closed-loop pole pair.

8.00
0.60
6.0°
0.0°
Reference tracking. The reference $\theta_r$ shifts the equilibrium angle the controller maintains. The plant follows it, with a steady-state offset determined by the proportional gain. Increasing $K_p$ reduces the offset; increasing $K_d$ damps oscillation about the reference.

The same principle generalises to plants of arbitrary order and to controllers of higher complexity than PD. For any $C(s)$, the closed-loop characteristic polynomial $1 + G(s)C(s) = 0$ governs stability, and the design objective is to choose $C(s)$ such that all of its roots lie in the left half-plane.

open-loop vs closed-loop response